<%@ page language="java" contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <%@ include file="./head.jsp" %>
		 

		<TABLE height=330 cellSpacing=0 cellPadding=0 width="100%"
			align=center border=0>
			<TBODY>
				<TR>
					<TD vAlign=center align=middle
						background="image/products.jpg">
						<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
							<TBODY>
								<TR>
									<TD width="15%">
										&nbsp;
									</TD>
									<TD width="85%">
										<embed src="image/9.swf" width="480" height="220"
											quality="high"
											pluginspage="http://www.macromedia.com/go/getflashplayer"
											type="application/x-shockwave-flash" wmode="transparent">
										<A href="image/9.swf"></A>
										</embed>
									</TD>
								</TR>
							</TBODY>
						</TABLE>
					</TD>
				</TR>
			</TBODY>
		</TABLE>
		<TABLE height=9 cellSpacing=0 cellPadding=0 width="100%" align=center
			border=0>
			<TBODY>
				<TR>
					<TD></TD>
				</TR>
			</TBODY>
		</TABLE>
		<TABLE height=339 cellSpacing=0 cellPadding=0 width="100%" border=0>
			<TBODY>
				<TR>
					<TD vAlign=top height=339>
						&nbsp;
					</TD>
					<TD vAlign=top width=1003>
						<TABLE cellSpacing=0 cellPadding=0 width="100%" align=right
							border=0>
							<TBODY>
								<TR>
									<TD width=1 bgColor=#e9e9e9 height=391></TD>
									<TD vAlign=top width=243 bgColor=#ffffff>
										<TABLE height=32 cellSpacing=0 cellPadding=0 width=225
											align=center border=0>
											<TBODY>
												<TR>
													<TD style="PADDING-LEFT: 35px"
														background="image/v.jpg">
														<SPAN class=STYLE1>产品列表</SPAN>
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE cellSpacing=0 cellPadding=0 width=225 align=center
											border=0>
											<TBODY>
												<TR>
													<TD>
														&nbsp;
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<table align="center" border="0" cellpadding="0" cellspacing="0"
											width="225" id="product_mode_id" style="display: none">
											<tbody>
												<tr>
													<td class="sy_prd_fll" align="left">
														<a href="" id="products_a_id">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;保险杠喷涂</a>
													</td>
												</tr>
											</tbody>
										 </table>

										<TABLE cellSpacing=0 cellPadding=0 width=225 align=center
											border=0>
											<TBODY>
												<TR>
													<TD>
														&nbsp;
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE height=32 cellSpacing=0 cellPadding=0 width=225
											align=center border=0>
											<TBODY>
												<TR>
													<TD style="PADDING-LEFT: 35px"
														background="image/v.jpg">
														<SPAN class=STYLE1>产品搜索</SPAN>
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE cellSpacing=0 cellPadding=0 width=225 align=center
											border=0>
											<TBODY>
												<TR>
													<TD>
														&nbsp;
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE cellSpacing=0 cellPadding=0 width=225 align=center
											border=0>
											<TBODY>
												<TR>
													<TD width=61 rowSpan=2>
														<IMG height=58 src="image/arr_sear.gif" width=47>
													</TD>
													<TD width=164>
														请输入产品名称进行搜索
													</TD>
												</TR>
												<TR>
													<TD>
														<FORM id=form name=form action=products.asp method=post>
															<LABEL></LABEL>
															<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
																<TBODY>
																	<TR>
																		<TD>
																			<INPUT size=15 name=key>
																		</TD>
																		<TD>
																			<A href=""><IMG height=19
																					src="image/login.jpg" width=52 border=0>
																			</A>
																		</TD>
																	</TR>
																</TBODY>
															</TABLE>
														</FORM>
													</TD>
												</TR>
											</TBODY>
										</TABLE>
									</TD>
									<TD width=1 bgColor=#e9e9e9></TD>
									<TD vAlign=top>
										<TABLE cellSpacing=0 cellPadding=0 width="100%"
											background="image/aa_3[1].jpg" border=0>
											<TBODY>
												<TR>
													<TD vAlign=top height=45>
														<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
															<TBODY>
																<TR>
																	<TD align=middle width="16%">
																		<TABLE height=24 cellSpacing=0 cellPadding=0 width=86
																			background="image/cc_4[1].jpg" border=0>
																			<TBODY>
																				<TR>
																					<TD align=middle>
																						<SPAN class=STYLE1>产品中心</SPAN>
																					</TD>
																				</TR>
																			</TBODY>
																		</TABLE>
																	</TD>
																	<TD width="58%">
																		&nbsp;
																	</TD>
																	<TD align=middle width="26%">
																		<IMG height=7 src="image/1_9[1].jpg" width=5
																			border=0>
																		&nbsp;
																		
																		<A href="./home/first.do">首页</A>&nbsp;&gt;&gt;&nbsp;产品中心
																	</TD>
																</TR>
															</TBODY>
														</TABLE>
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE cellSpacing=0 cellPadding=0 width="96%" align=center  
											border=0>
											<TBODY>
												<TR >
													<TD class=ted align=left>
														<TABLE cellSpacing=0 cellPadding=0 border=0 id="table_model_id" style="display:none">
															<TBODY>
																<TR id="tr_model_id">
																	<TD style="PADDING-LEFT: 25px" id="td_model_id">
																		<TABLE cellSpacing=0 cellPadding=0 align=left border=0>
																			<TBODY>
																				<TR>
																					<TD>
																						<TABLE cellSpacing=1 cellPadding=0 bgColor=#cccccc
																							border=0>
																							<TBODY>
																								<TR>
																									<TD align=middle id=""
																										background=""
																										bgColor=#ffffff>
																										<A title="" id="pic_a_id"
																											href="">
																											<img src="" id="pic_td_id" width="200" height="150"/>
																										</A>
																									</TD>
																								</TR>
																							</TBODY>
																						</TABLE>
																					</TD>
																				</TR>
																				<TR>
																					<TD align=middle height=24>
																						<A title=""
																							href="#" id="product_name_a"></A>
																					</TD>
																				</TR>
																			</TBODY>
																		</TABLE>
																	</TD>
																</TR>
															</TBODY>
														</TABLE>
<!--														<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>-->
<!--															<TBODY>-->
<!--																<TR>-->
<!--																	<TD align=left>-->
<!--																		<SPAN class=tedaea>第一页</SPAN></A>&nbsp;-->
<!--																		<SPAN class=tedaea>上一页</SPAN></A>&nbsp;-->
<!--																		<SPAN class=tedaea>1</SPAN> &nbsp;-->
<!--																		<A class=tedaea-->
<!--																			href="http://www.hongsheng99.com/?classid=&page=2">2</A>-->
<!--																		&nbsp;-->
<!--																		<A class=tedaea-->
<!--																			href="http://www.hongsheng99.com/?classid=&page=3">3</A>-->
<!--																		&nbsp;-->
<!--																		<A class=tedaea-->
<!--																			href="http://www.hongsheng99.com/?classid=&page=4">4</A>-->
<!--																		&nbsp;-->
<!--																		<A class=tedaea-->
<!--																			href="http://www.hongsheng99.com/?classid=&page=5">5</A>-->
<!--																		&nbsp;-->
<!--																		<A href="http://www.hongsheng99.com/?classid=&page=2"><SPAN-->
<!--																			class=tedaea>下一页</SPAN>-->
<!--																		</A>-->
<!--																		<A href="http://www.hongsheng99.com/?classid=&page=11">&nbsp;-->
<!--																			<SPAN class=tedaea>最后页</SPAN>-->
<!--																		</A>&nbsp;-->
<!--																	</TD>-->
<!--																</TR>-->
<!--															</TBODY>-->
<!--														</TABLE>-->
													</TD>
												</TR>
											</TBODY>
										</TABLE>
										<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
											<TBODY>
												<TR>
													<TD>
														&nbsp;
													</TD>
												</TR>
											</TBODY>
										</TABLE>
									</TD>
									<TD width=1 bgColor=#e9e9e9></TD>
								</TR>
							</TBODY>
						</TABLE>
					</TD>
					<TD vAlign=top>
						&nbsp;
					</TD>
				</TR>
			</TBODY>
		</TABLE>
		 <%@ include file="./foot.jsp" %>
		 <script>
	$(function(){
		jQuery.ajax( {
			type : 'GET',
			url : './products/getByPage.do?currPage=1',
			dataType : 'json',
			success : function(obj) {
				var size = obj.productsList.length;
				//设置产品名称
				for(var i = 0 ;i<obj.productsList.length;i++){
	          		var html = $('#product_mode_id').html();
	          		var newTr = '<table align="center" border="0" cellpadding="0" cellspacing="0" width="225">'+html+'</table>';
	          		var newTrObj = $('#product_mode_id').after(newTr).next();
	          		newTrObj.find('#products_a_id').html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+obj.productsList[i].name);
	          		newTrObj.find('#products_a_id').attr("href","./home/productDetail.do?id="+obj.productsList[i].id);
			     }
			     
			     //设置产品图片
			     var line = 0;
			     var modNum = 0;
			     if(size % 3 !=0){
			     	line = parseInt(size/3)+1;
			     	modNum = size%3;
			     }else{
			     	line = size/3;
			     }
			     
			     for(var j = 0 ;j<line;j++){
			     	 	var firsthtml = '<TABLE cellSpacing=0 cellPadding=0 border=0 id=""><TBODY><TR>';
						var tdHtml = "";
						var n = 3;
						if(j == line-1 && modNum != 0){
							n = modNum;
						}
						for(var k =0;k<n;k++){
						 	 tdHtml += '<TD style="PADDING-LEFT: 25px" id="">'+$("#td_model_id").html()+'</TD>';
						}
			     	 	var endhtml = "</TR></TBODY></TABLE";
				 		var html = firsthtml+tdHtml+endhtml;
				 		var newTab = $('#table_model_id').before(html).prev();
				 		
				 		var beginIndex = j*3;
				 		newTab.find('#pic_td_id').each(
				 			function(){
				 				$(this).attr("src","./upload/downloadCompress.do?fileName="+obj.productsList[beginIndex].picName);
				 				beginIndex++;
				 			}
				 		);
				 		
				 		var beginIndex1 = j*3;
				 		newTab.find('#pic_a_id').each(
				 			function(){
				 				$(this).attr("href","./home/productDetail.do?id="+obj.productsList[beginIndex1].id);
				 				beginIndex1++;
				 			}
				 		);
				 		
				 		var beginIndex2 = j*3;
				 		newTab.find('#product_name_a').each(
				 			function(){
				 				$(this).attr("href","./home/productDetail.do?id="+obj.productsList[beginIndex2].id);
				 				$(this).html(obj.productsList[beginIndex2].name);
				 				beginIndex2++;
				 			}
				 		);
				 		
			     }
			},
			error : function() {
				//alert('error');
			}
		});
	});
</script>
	</BODY>

</html>
